#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 50 + 10;

int t, n;
ll a[N];

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin >> t;
    while (t--) {
        cin >> n;
        for (int i = 1; i <= n; i++) cin >> a[i];

        set<int> s;

        for (int i = 1; i <= n; i++) {
            while (a[i] > n || s.find(a[i]) != s.end()) {
                a[i] /= 2;
            }
            if (a[i] != 0)
            s.insert(a[i]);
        }

        bool flag = true;
        for (int i = 1; i <= n; i++) {
            if (s.find(i) == s.end()) {
                flag = false;
                break;
            }
        }
        puts(flag ? "YES" : "NO");

    }
    return 0;
}